#!/usr/bin/env node
//turn a list of files into depfile in makefile format
const fs = require('fs');

const target = process.argv[2];
const filePath = process.argv[3];

const deps = fs.readFileSync(filePath, 'utf8');

const relativeDeps = [];
for (let dep of deps.split('\n')) {
    relativeDeps.push(dep.replace(__dirname + '/', ''));
}

const out = target + ': ' + relativeDeps.join(' ');

fs.writeFileSync(filePath, out);
